{if $bDoRefresh}
<script type="text/javascript" language="javascript">window.top.location.href='{url link='admin.language.manager'}'</script>
{/if}

{literal}
<script type="text/javascript">

function forumRedirect(usergroupid)
{
	task = eval("document.cpform.u" + usergroupid + ".options[document.cpform.u" + usergroupid + ".selectedIndex].value");

	switch(task)
	{
	{/literal}
		case 'phrases':
		window.location.href = "{url link='admin.language.phrases'}id_"+ usergroupid +"/";
		break;
		case 'content':
		window.location.href = "{url link='admin.language.phrases' content='true'}id_"+ usergroupid +"/";
		break;
		case 'default':
		window.location.href = "{url link='admin.language.manager'}default_"+ usergroupid +"/";
		break;
		case 'edit':
		window.location.href = "{url link='admin.language.edit'}id_"+ usergroupid +"/";
		break;
		case 'delete':
		{literal}
		if ( sure() )
		{
		{/literal}
			window.location.href = "{url link='admin.language.manager'}deleteid_"+ usergroupid +"/";
		{literal}
		}
		else
		{
			return false;
		}
		{/literal}
		break;
		case 'missing':
		window.location.href = "{url link='admin.language.missing'}id_"+ usergroupid +"/";
		break;
		case 'options':
		window.location.href = "{url link='admin.language.options'}id_"+ usergroupid +"/";
		break;
		case 'missing-options':
		window.location.href = "{url link='admin.language.missing-options'}id_"+ usergroupid +"/";
		break;
		case 'duplicate-options':
		window.location.href = "{url link='admin.language.duplicate-options'}id_"+ usergroupid +"/";
		break;
		default:
			return false;
		break;
	{literal}
	}
}

</script>
{/literal}
{messages}
<form method="post" action="{url link='current'}" name="cpform" id="cpform">
<table cellspacing="0" cellpadding="0" class="forumline" style="width:100%;">
<tr>
	<td colspan="7" class="row-header"><span>{language text='menu.language.manager'}</span></td>
</tr>
<tr>
	<th>
		{language text='language'}
	</th>
	<th>
		{language text='language_code'}
	</th>
	<th>
		{language text='language_charset'}
	</th>
	<th>
		{language text='language_added_on'}
	</td>
	<th>
		{language text='language_added_by'}
	</th>
	<th>
		{language text='language_actions'}
	</th>
</tr>
{foreach from=$aItems item=aItem}
<tr>
	<td class="row1">
		<b>{$aItem.title}</b>
	</td>
	<td class="row1">
		{$aItem.languagecode}
	</td>
	<td class="row1">
		{$aItem.charset}
	</td>
	<td class="row1">
		{$aItem.time|date_format:$sDateFormat}
	</td>
	<td class="row1">
	{if $aItem.created}
		<a href="http://{$aItem.site|replace:'http://':''}">{$aItem.created}</a>
	{else}
	N/A
	{/if}
	</td>
	<td class="row1" style="text-align:right;">
		<select name="u{$aItem.id}" onchange="forumRedirect({$aItem.id});" style="width:175px;">
			<option value="edit">{language text='language_edit_settings'}</option>
			<option value="phrases">{language text='language_edit_phrases'}</option>
			<option value="options">{language text='Mod_Language.edit_options'}</option>
			<option value="content">{language text='Mod_Language.edit_site_content'}</option>
			<option value="missing">{language text='Mod_Language.find_missing_phrases'}</option>
			<option value="missing-options">{language text='Mod_Language.find_missing_options'}</option>
			<option value="duplicate-options">{language text='Mod_Language.find_duplicate_options'}</option>
			{if !$aItem.default}
			<option value="default">{language text='language_set_as_default'}</option>
			{if $aItem.id != '1'}
			<option value="delete">{language text='delete'}</option>
			{/if}
			{/if}
		</select>
		<input type="button" value="{language text='go'}" name="go" onclick="forumRedirect({$aItem.id});" />
	</td>
</tr>
{/foreach}
<tr>
     <td colspan="7" class="catBottom" style="text-align:center;">
     	<input type="button" name="add" value="{language text='Mod_Language.create_new_language'}" onclick="window.location.href='{url link='admin.language.create'}';" />
		<input type="button" name="add" value="{language text='upload_new_language_package'}" onclick="window.location.href='{url link='admin.language.add'}';" />
		<input type="button" name="add" value="{language text='Mod_Language.modify_collation'}" onclick="window.location.href='{url link='admin.language.collation'}';" />
     </td>
</tr>
</table>
</form>